package com.nhjf.mobile.interceptor;


import java.util.Map;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.nhjf.common.util.StringUtil;
import org.apache.commons.httpclient.cookie.CookieSpec;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSONObject;
import com.nhjf.mobile.common.util.HttpUtil;
import com.nhjf.mobile.common.util.SysProperties;

import com.nhjf.pojo.dto.result.ServiceResultDto;


/**
 * 拦截器
 * @author 拦截器
 *
 */
public class CommonInterceptor implements HandlerInterceptor {


	private Logger logger = Logger.getLogger(CommonInterceptor.class);

	public CommonInterceptor() {
	}

	@Override
	public boolean preHandle(HttpServletRequest request,HttpServletResponse response, Object handler) throws Exception {
//		LogFlow flow = new LogFlow("拦截", CommonInterceptor.class, LogFlow.LOG_LEVEL_DEBUG);
		// log.info("==============执行顺序: 1、preHandle================");
//		String url = request.getRequestURL().toString();
		

		//yaozl add end
			
//		if (url.indexOf("/resources") > 0 || url.indexOf("/login") > 0 || url.indexOf("/home") > 0 || url.indexOf("/product") > 0 || url.indexOf("/service") > 0 || url.indexOf("/active") > 0 || url.indexOf("/promotion") > 0 || url.indexOf("/preferential") > 0 || url.indexOf("/special_topic") > 0) {
//			return true;
//		}



				return true;
			

			
		
	}

	@Override
	public void postHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {
//		 log.info("==============执行顺序: 2、postHandle================");
		//获取图片地址
//		String imagePath = SysProperties.getInstance().get("imagePath");
//		request.setAttribute("imagePath", imagePath);
	}

	@Override
	public void afterCompletion(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception ex)
			throws Exception {
//		 log.info("==============执行顺序: 3、afterCompletion================");
	}

}
